package com.zhc.dejingapi.job;

import com.zhc.dejingapi.service.dingtalk.IDealDingCallBackDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

@Slf4j
@Configuration
public class DingDealCallBackDataJob {
    public  static  boolean isRunning=false;
    private final JdbcTemplate mysqlJdbcTemplate;

    private final IDealDingCallBackDataService dealDingCallBackDataService;

    public DingDealCallBackDataJob(@Qualifier("mySqlJdbcTemplate")JdbcTemplate mysqlJdbcTemplate1,
                                   IDealDingCallBackDataService dealDingCallBackDataService1) {
        this.mysqlJdbcTemplate = mysqlJdbcTemplate1;
        this.dealDingCallBackDataService = dealDingCallBackDataService1;
    }

    public  void executeJob(){
        if(isRunning){
            log.info("DingCallBackDataDealJob is running");
            return;
        }
        isRunning=true;
        int i=0;
        if(i==1){
            try {
                dealDingCallBackDataService.DealData();
            }
            catch (Exception e){
                e.printStackTrace();
                log.error("ERPProdClassToQingJob error",e);
            }

        }

        isRunning=false;
    }

}
